package com.itstyle.seckill.du.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author duzining
 */
@Configuration
public class DuRedissonConfig {

    @Value("${redisson.address}")
    private String redisAddressUrl;

    @Bean
    public RedissonClient getRedisson() throws Exception{
        RedissonClient redissonClient = null;
        Config config = new Config();
        config.useSingleServer()
                .setAddress(redisAddressUrl);
        redissonClient = Redisson.create(config);
        return redissonClient;
    }


}
